package VN.EDU.IMIC.DEVELOPER.NGUYENVANTHIEN.EXAM01.Bai1;

public class Model {
	//hình chữ nhật
	
	public double ChuVi(EntityHinhChuNhat objHCN) {
		return  (objHCN.getDai() + objHCN.getRong()) * 2;
	}

	public double DienTich(EntityHinhChuNhat objHCN) {
		return   objHCN.getDai() * objHCN.getRong();
	}
	
	//Hình tam giác
	public double ChuViTG(HinhTamGiac objHTG){
		return (objHTG.getCanh1()*objHTG.getCanh2()*objHTG.getCanh3())/3;
	}
	public double DienTichTG(HinhTamGiac objHTG){
		double p = (objHTG.getCanh1()*objHTG.getCanh2()*objHTG.getCanh3())/3;
		
		return Math.sqrt((p-objHTG.getCanh1())*(p-objHTG.getCanh2()) * (p-objHTG.getCanh3()));
	}
	
	//Hình thang
	public double ChuViHT(HinhThang objHinhThang){
		return objHinhThang.getCanh1()+objHinhThang.getCanh2()+objHinhThang.getCanh3()+objHinhThang.getCanh4();
	}
	public double DienTichHT(HinhThang objHinhThang){
		return (((objHinhThang.getCanh1()+objHinhThang.getCanh3()))/2)*0.5;
	}
	
	//Hình bình Hành
	public double ChuViHBH(HinhBinhHanh objHBH){
		return (objHBH.getKe1()+objHBH.getKe2())*2;
	}
	public double DienTich(HinhBinhHanh objHBH){
		return objHBH.getKe1()*objHBH.getCao();
	}
	
	//Hình Thoi
	
	public double ChuViHThoi(HinhThoi objHinhThoi){
		return objHinhThoi.getCanh()*4;
	}
	public double DienTichHThoi(HinhThoi objHinhThoi){
		return (objHinhThoi.getDc1()*objHinhThoi.getDc2())*0.5;
	}
	
	
}